Skip to content

feat(pi): deploy from CI-gated ref via comin (candidate C)#484

Open
etrobert-bot wants to merge 1 commit into
mainfrom
pi-deploy-comin
Open

feat(pi): deploy from CI-gated ref via comin (candidate C)#484
etrobert-bot wants to merge 1 commit into
mainfrom
pi-deploy-comin

Conversation

@etrobert-bot

Copy link
Copy Markdown
Collaborator

Closes #481

Candidate C (comin-based gated pull) — a third alternative to A (#483) and B (#482); only one of the three merges. Same shape as A (pi pulls a CI-gated deploy ref), but the on-pi mechanism is comin instead of system.autoUpgrade + a custom gate script.

What

  • New comin flake input (github:nlewo/comin, nixpkgs.follows set; not in nixpkgs). Lock diff is comin + its transitive deps only — all existing inputs unchanged.
  • Same CI deploy job as candidate A: main pushes only, after all-builds succeeds, fast-forwards deploy via git push origin HEAD:deploy.
  • Pi: system.autoUpgrade removed entirely; services.comin tracks deploy (branches.main.name = "deploy"), everything else at defaults — 60 s poll period, /var/lib/comin state, no testing-branch wiring.

Invariant: never deploy raw main

deploy only moves when all-builds is green (aarch64 closure already in Cachix via tower's post-build hook). comin is the sole deploy mechanism — no ungated nightly exception.

Source-verified behavior (comin 0.13.0)

  • Before CI first creates the deploy ref, comin logs the missing branch and keeps polling — the unit never fails permanently.
  • No redeploy loop: deploys only fire on a new head, gated by IsAlreadyDeployed; state survives reboots.
  • Prometheus exporter defaults to port 4243, but pi's firewall (only 22/22000 open, lo trusted) drops it on LAN and tailnet — loopback only.

Comparison criteria (vs A and B)

  • Latency: same as A — CI + on-pi eval (~3–5 min on the Pi 4); poll starts ≤1 min after CI green.
  • Credential surface: none (public repo over https).
  • Pi offline: converges by itself when back, like A.
  • Moving parts: zero custom code (A's gate-script state machine is replaced by comin's built-in fetcher/deployer), at the cost of one new third-party flake dependency.

🤖 Generated with Claude Code

Replace pi's nightly system.autoUpgrade with comin, a pull-based GitOps
deployer. comin polls the `deploy` ref every ~60s and switches to
nixosConfigurations.pi. A new CI `deploy` job fast-forwards `deploy` to
each merged commit only after all-builds passes, so pi never deploys raw
main and converges within a minute of CI going green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deploy pi from main within minutes: gated pull vs CI push

1 participant